<template>
	<div>
		<van-swipe-cell v-for="(v, i) in historyList" :key="i">
			<ListItem :v="v"></ListItem>
			<template #right>
				<van-button square text="删除" type="danger" class="delete-button" 
					@click="store.commit('removeHistoryList', v)"/>
			</template>
		</van-swipe-cell>
	</div>
</template>

<script lang="ts" setup>
import { useStore } from 'vuex'
import { RootState } from '@/store'
import { computed } from '@vue/reactivity';
import ListItem from '@/components/ListItem/ListItem.vue'
const store = useStore<RootState>()
const historyList = computed(() => store.state.historyList)
</script>

<style>
.delete-button {
	height: 100%;
}
</style>